using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using MIMPGameLibrary;

namespace MIMP
{
    /// <summary>
    /// Enumerates the functions of the UI buttons in the game.
    /// </summary>
    public enum UIButtons { Attack, Move, EndTurn, ScrollUp, ScrollDown, ScrollRight, ScrollLeft, 
        Menu, SecondMove, Next, Prev, Add, Del, Help, SetupDone, SelectDefenders, None }
    /// <summary>
    /// Extends SpriteDisplay to hold a button ID to associate with the SpriteDisplay.
    /// </summary>
    public class UIButtonDisplay : SpriteDisplay
    {
        /// <summary>
        /// Returns a string with the name of the UIButton's function.
        /// </summary>
        /// <param name="button"></param>
        /// <returns></returns>
        public static String UIBUttonName(UIButtons button)
        {
            switch (button)
            {
                case UIButtons.Attack: return "Attack";
                case UIButtons.EndTurn: return "End turn";
                case UIButtons.Menu: return "Menu";
                case UIButtons.Move: return "Move";
                case UIButtons.SecondMove: return "Second Move";
                case UIButtons.Next: return "Next Monster";
                case UIButtons.Prev: return "Previous Monster";
                case UIButtons.Help: return "Help";
                case UIButtons.Add: return "Add New Monster";
                case UIButtons.Del: return "Delete Selected Monster";
                case UIButtons.SetupDone: return "End setup phase";
                default: return "";
            }
        }
        
        private UIButtons buttonID;
        /// <summary>
        /// Identifies the function that this button fulfills.
        /// </summary>
        public UIButtons ButtonID
        {
            get { return buttonID; }
            set { buttonID = value; }
        }

        /// <summary>
        /// Constructs a new UIButton at the given location.
        /// </summary>
        /// <param name="x">X coordinate of the origin of the display.</param>
        /// <param name="y">Y coordinate of the origin of the display.</param>
        /// <param name="sprite">The sprite to draw.</param>
        /// <param name="buttonID">Identifies the functionality of this button.</param>
        /// <param name="scale">The factor by which to scale the sprite when drawing.</param>
        /// <param name="isClickable">True if the button can be clicked on by the user.</param>
        /// <param name="isVisible">True if the button should be drawn.</param>
        public UIButtonDisplay(float x, float y, float scale, Texture2D sprite, Keys key, UIButtons buttonID, bool isVisible, bool isClickable )
            : base(x, y, scale, key, sprite, isVisible, isClickable)
        {
            this.buttonID = buttonID;
        }

        public UIButtonDisplay(float x, float y, float scale, Texture2D sprite, Keys key, UIButtons buttonID)
            : this(x, y, scale, sprite, key, buttonID, true, true)
        { }
    }
}
